import { getApplication } from "@/core/app";
import { ECameraMoveDirection, ModelCameraService } from "@manycore/custom-sdk";
import hotkeys from "hotkeys-js";

/** 注册场景相机方向移动相关快捷键 */
hotkeys('*', function (event, handler) {
  let arrow: ECameraMoveDirection | undefined = undefined;
  switch (event.key) {
    case 'w':
      arrow = ECameraMoveDirection.FRONT;
      break;
    case 's':
      arrow = ECameraMoveDirection.BACK;
      break;
    case 'a':
      arrow = ECameraMoveDirection.LEFT;
      break;
    case 'd':
      arrow = ECameraMoveDirection.RIGHT;
      break;
    case 'q':
      arrow = ECameraMoveDirection.UP;
      break;
    case 'e':
      arrow = ECameraMoveDirection.DOWN;
      break;
  }
  if (arrow) {
    const cameraService = getApplication().getService(ModelCameraService);
    cameraService.moveCamera(arrow);
  }
})